package org.linuxsogood.boot.controller;

import org.linuxsogood.boot.service.RetryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class IndexController {

    @Autowired
    private RetryService retryService;

    @RequestMapping("/")
    public String index() {;
        return "index";
    }

    @GetMapping("/springboot/{id}")
    public String springbootById(@PathVariable int id){
        return "springboot-"+id;
    }
    @GetMapping("/work/{id}")
    public String work(@PathVariable int id){
        return "work-"+id;
    }

    @GetMapping("params")
    public String params(@RequestParam String param) {
        return param;
    }

    @GetMapping("/retry")
    public String retry() {
        int retry = retryService.retry(5);
        return "stock: " + retry;
    }
}
